home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_55 / ruckmidi.doc < prev    next >
Text File  |  1995-01-01  |  73KB  |  2,469 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.      RUCKUS-MIDI Copyright (C)1993 Cornel Huth
  8.      Documentation Copyright (C)1993 Cornel Huth
  9.      All Rights Reserved.
  10.  
  11.      Version 1.0d.
  12.      18-Oct-93/C.
  13.  
  14.      For ordering information, license agreement, and product support
  15.      information, see Appendix Z.
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.      Introduction
  74.  
  75.      RUCKUS-MIDI is one part of the RUCKUS sound toolkit for DOS programmers.
  76.      Its forte is its ability to play MIDI data in three different formats.
  77.      Standard MIDI file format, type-0 and type-1 with selectable programs of
  78.      the General MIDI Sound Set, the MT-32, or one of the programmer's choosing.
  79.      Also supported is the CMF type (Creative Music File format, similar to
  80.      Standard MIDI) and ROL-converted MIDI type (ROL is the file type used by
  81.      the AdLib MSC). The other part of the RUCKUS sound toolkit is RUCKUS-DAC.
  82.      Its forte is its ability to play and record digital data in three formats:
  83.      VOC, WAVE, and Amiga Module. See RUCKUS-DAC for more.
  84.  
  85.      RUCKUS-MIDI currently supports the AdLib MSC and compatibles. This includes
  86.      all Sound Blasters and its clones, as well. RUCKUS-MIDI is implemented to
  87.      be device-independent. As new sound hardware (with supporting
  88.      documentation) becomes available to this programmer, it will be added. The
  89.      code you write to play MIDI music using RUCKUS will play on any new device
  90.      added later without any code changes to your program. You just supply the
  91.      new device ID (see InitMidi for more). RUCKUS-DAC already supports several
  92.      sound devices in a device-independent manner.
  93.  
  94.      The RUCKUS toolkit supports most DOS compilers as is. This documentation
  95.      describes using RUCKUS with C DOS compilers. Also available is a BASIC-
  96.      specific version (BASIC7/QB45/VBDOS/etc.) of this documentation. Other
  97.      implementations should be able to get the necessary details using this
  98.      documentation. Note that these toolkits will not work with the current or
  99.      past Turbo Pascal compilers. This is due to Turbo Pascal's proprietary
  100.      linkage methods.
  101.  
  102.      To provide compiler-independence, RUCKUS (and all of my latest toolkits)
  103.      implements a simple calling scheme: a single far pointer is passed to
  104.      RUCKUS. The data structure that is pointed to varies depending on RUCKUS
  105.      function. There are 11 structure types ("packs") currently. The first two
  106.      data members of each pack are identical in all packs. These are Func and
  107.      Stat. The remaining members, if any, vary depending on requirements. For
  108.      instance, the LoadMidi routine uses, in addition to Func and Stat, four
  109.      additional members: FilenamePtr, StartPos, LoadSize, and LoadPtr. The steps
  110.      needed to load a MIDI data file to memory would be as follows:
  111.  
  112.  
  113.           1. Allocate pack. Packs are reusable and can be allocated any way you
  114.           want. Here we make a static allocation for simplicity.
  115.  
  116.           struct LoadMidiPack LMP;
  117.  
  118.           2. Assign member values:
  119.       
  120.           gets(filename);
  121.           LMP.Func = LoadMidi;
  122.           LMP.FilenamePtr = filename;
  123.           LMP.StartPos = 0L;                    
  124.           LMP.LoadSize = 0L;
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.           3. Call RUCKUS:
  141.  
  142.           rez = RUCKMIDI(&LMP);
  143.  
  144.           4. On return from the call:
  145.  
  146.           if (rez == 0) 
  147.              // LMP.LoadPtr -> address of MIDI data in memory
  148.  
  149.      After the load you can immediately call the PlayMidi routine using the
  150.      lmp.LoadPtr returned from the Load call. You don't need to use the RUCKUS
  151.      LoadMidi routine; you can perform your own MIDI data file loads to memory.
  152.      However, RUCKUS can load up to 32 separate MIDI data files at one time and
  153.      performs all the necessary memory allocations and deallocations
  154.      automatically. See LoadMidi for more.
  155.  
  156.      As you can see, using RUCKUS is easy. If you'd rather use a traditional 
  157.      calling convention, wrap the RUCKUS routines in a C function and call it as
  158.      you normally would, e.g., rez = LoadDacFile(filename,LP) where LoadDacFile
  159.      contains the actual code (as shown above).
  160.  
  161.      Now that I have your interest, let me tell you why I've provided this
  162.      toolkit for you. Shareware. That's right. Shareware. What I've done is
  163.      provide you with a means to evaluate this product completely, with no
  164.      upfront obligations. If you can't make use of this product, no problem.
  165.      Think of this as the ultimate return policy. You can actually take the
  166.      goods home, try it out, break it in. Then, if after a period of no more
  167.      than 21 days, you feel that this product is well worth the price I'm
  168.      asking, by all means, you should go ahead and fill out the order form and
  169.      send it in. If you do not register, then of course, it means the product is
  170.      not something you can use. If you can't use it, I don't want your money.
  171.      But if it's something you will use, it's only fair that you register. The
  172.      PROFESSIONAL registered versions does not have any built-in advertising
  173.      screens. The PERSONAL DEVELOPER registered version does display a sign-on
  174.      banner once. See Appendix Z. for ordering options and other related
  175.      information specific to this product.
  176.  
  177.      The documentation that follows describes each of the function routines as
  178.      to use, pack type used, and sample code in C. Also available is a BASIC
  179.      version of this toolkit, differing only in example programs and
  180.      documentation. For additional source examples see the included X files on
  181.      disk.
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.      RUCKUS-MIDI Functions.
  206.  
  207.       0. SysInfoMidi ...........................................  5
  208.       1. InitMidi ..............................................  6
  209.       2. ExitMidi ..............................................  7
  210.       3. AtExitMidi ............................................  8
  211.       4. LoadMidi ..............................................  9
  212.       5. PlayMidi .............................................. 10
  213.          6 and 7 are not used
  214.       8. EndMidi ............................................... 11
  215.       9. PauseMidi ............................................. 12
  216.      10. DeallocMidi ........................................... 13
  217.      11. FastFwdMidi ........................................... 14
  218.      12. OutMsgMidi ............................................ 15
  219.          13 to 19 are not used 
  220.      20. SetAllMidi ............................................ 16
  221.      21. SetVolumeMidi ......................................... 17
  222.      22. SetToneMidi ........................................... 18
  223.      23. SetPatchMidi .......................................... 19
  224.      24. SetChMaskMidi ......................................... 20
  225.          25 to 29 are not used
  226.      30. SetAllFMSBP ........................................... 21
  227.  
  228.          Appendix A. Tips and Tricks ........................... 22
  229.          Appendix B. Pack Structure ............................ 23
  230.          Appendix C. Compiler, Linker and Call Use ............. 26
  231.          Appendix D. RUCKUS-MIDI Data Area ..................... 27
  232.          Appendix E. Key#, Frequencies and Channel Messages .... 28
  233.          Appendix F. General MIDI Sound Set .................... 30
  234.          Appendix G. MT-32 Sound Set ........................... 32
  235.          Appendix H. Patch Map Format .......................... 34
  236.          Appendix Z. Ordering Information, License Agreement
  237.                      and Product Support........................ 36
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.      SysInfoMidi         Func: 0        Pack: SysInfoMidiPack
  272.  
  273.  
  274.      Determine which RUCKUS-supported devices are available on the current
  275.      machine. Information returned on detected devices includes base I/O port
  276.      and channel information (a mask indicating available channels). 
  277.  
  278.      SysInfoMidi may be called only if no RUCKUS-MIDI device is active. If you
  279.      an active device (via InitMidi), perform an ExitMidi before calling this
  280.      function.
  281.  
  282.      Device ID      RUCKUS-MIDI supports the following:
  283.  
  284.           0         AdLib melodic, MIDI channels 0 to 8.
  285.  
  286.           1         AdLib percussive, MIDI channels 0 to 5, and 9.
  287.                     The drum channel (9) is programmer-selectable and 
  288.                     it maps to the 5 additional percussive voices.
  289.  
  290.           2*        Dual-3812 percussive, MIDI channels 0 to 11, and 9.
  291.                     Selectable stereo channels, 6 per side, or 12 mono.
  292.                     The drum channel (9) is programmer-selectable and
  293.                     it maps to the 5 additional percussive voices.
  294.  
  295.           3*        OPL3 percussive, MIDI channels 0 to 8, 10 to 12, and 9.
  296.                     Each channel selectable to play left, right, or both.
  297.                     The drum channel (9) is programmer-selectable and
  298.                     it maps to the 5 additional percussive voices.
  299.  
  300.           4*        OPL3 percussive, MIDI channels 0 to 8, and 9.
  301.                     Each channel selectable to play left, right, or both.
  302.                     The drum channel (9) is programmer-selectable and
  303.                     it maps to the 5 additional percussive voices.
  304.                     4-operator timbre data for channels 0 to 5, and 
  305.                     2-operator timbre data for channels 6 to 8.
  306.  
  307.           5*        UltraSound (GUS), MIDI channels 0 to 15, and 9.
  308.                     The drum channel (9) is programmer-selectable.
  309.  
  310.      * Devices 2 to 5 to be supported in future releases. Specs are preliminary.
  311.  
  312.      Sample Use:
  313.  
  314.      struct SysInfoMidiPack SIMP;
  315.  
  316.      SIMP.Func = SysInfoMidi;
  317.      rez = RUCKMIDI(&SIMP);
  318.      if (rez == 0)
  319.         // SIMP.Device0 is 1 if AdLib melodic mode available
  320.         // if above then SIMP.D0port is 388h
  321.         //               SIMP.D0mask is 1FFh
  322.         // SIMP.Device1 is 1 if AdLib percussive mode available
  323.         // if above then SIMP.D1port is 388h
  324.         //               SIMP.D1mask is 23Fh
  325.  
  326.                                                                                5
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.      InitMidi            Func: 1        Pack: mInitMidiPack
  338.  
  339.  
  340.      Initialize the RUCKUS-MIDI system to the following:
  341.  
  342.      DeviceID  - any of the supported devices found by SysInfoMidi.
  343.      IOport    - the base I/O port as reported by SysInfoMidi.
  344.      PercCh    - the channel to use for percussion mapping.
  345.      ChMask    - the 16-bit mask as reported by SysInfoMidi.
  346.      Flags     - additional options.
  347.  
  348.      No RUCKUS-MIDI routines can be called prior InitMidi except SysInfoMidi and
  349.      SetAllFMSBP.
  350.  
  351.      On return from a successful initialization, two segmented far pointers are
  352.      returned: InfoPtr and MidiExitPtr. 
  353.  
  354.      InfoPtr is used to locate the RUCKUS-MIDI data area for use with compilers
  355.      that do not handle external variable references (such as QuickBASIC). Other
  356.      compilers (such as C7) can reference RUCKUS-MIDI data directly by using the
  357.      MIDIDATA external structure reference (see Appendix D.).
  358.  
  359.      MidiExitPtr is used for those development systems that do not have direct
  360.      support for the ANSI _atexit procedure. MidiExitPtr is a function pointer
  361.      (far pointer -> MidiExit) of the routine that should be called before
  362.      termination of any program that uses RUCKUS-MIDI. Most development systems
  363.      do provide for _atexit since it provides for orderly program shutdown in
  364.      the case of abnormal termination. For those that don't, you must include
  365.      the stub object module NOATEXIT.OBJ. 
  366.  
  367.      Sample Use:
  368.  
  369.      struct InitMidiPack IMP;
  370.  
  371.      IMP.Func = InitMidi;
  372.      IMP.DeviceID = 1;
  373.      IMP.IOport = 0x388;  // or use SIMP.D1port
  374.      IMP.PercCh = 9;
  375.      IMP.ChMask = 0x023F; // or use SIMP.D1mask 
  376.                           // 0x23F=0000 00P0 0011 1111 binary (P=perc channel)
  377.      IMP.Flags = 0;       // see Appendix D. for bitmap of flags
  378.      rez = RUCKMIDI(&IMP);
  379.      if (stat == 0)
  380.         // okay
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.                                                                                6
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.      ExitMidi            Func: 2        Pack: XitMidiPack
  404.  
  405.  
  406.      After having initialized a device via InitMidi, you must call ExitMidi
  407.      before initializing a new device or before your program ends. ExitMidi
  408.      performs three tasks. It frees any memory directly allocated by RUCKUS-MIDI
  409.      (such as within LoadMidi), it shuts down the device last initialized, and
  410.      it restores any hooked interrupts.
  411.  
  412.      This function should be called before ending your program. If your
  413.      development system supports the ANSI _atexit, it will be called
  414.      automatically (see AtExitMidi below). 
  415.  
  416.      Sample Use:
  417.  
  418.      struct XitMidiPack XMP;
  419.  
  420.      // program has run its course, before exiting to DOS perform cleanup
  421.  
  422.      XMP.Func = ExitMidi;
  423.      rez = RUCKMIDI(&XMP);
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.                                                                                7
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.      AtExitMidi          Func: 3        Pack: XitMidiPack
  470.  
  471.  
  472.      AtExitMidi is used to register the MidiExit routine to be called as a
  473.      normal procedure in the ending of your program. It will be called by the
  474.      compiler's startup code after your program _main() has ended. This is
  475.      important since it ensures that all resources allocated by RUCKUS-MIDI are
  476.      freed and that the sound device is properly shut down.
  477.  
  478.      AtExitMidi should be called immediately after initializing your first
  479.      device. It need not (and should not) be called again during the program. In
  480.      other words, you can InitMidi/ExitMidi as many times during a program's
  481.      execution as you want, but you should only call AtExitMidi after the first
  482.      InitMidi. See AtExitDac for additional important information.
  483.  
  484.      It is possible for _atexit to fail to register ExitMidi. This would be the
  485.      result of too many registrations requests having been made to _atexit.
  486.      Since _atexit typically can handle 32 registrations, it is unlikely to fail
  487.      (fail=become full). If it does fail, it should _not_ be considered a fatal
  488.      error, however, be aware that the automatic ExitMidi call will not take
  489.      place.
  490.  
  491.      Sample Use:
  492.  
  493.      struct InitMidiPack IMP;
  494.      struct XitMidiPack XMP;
  495.      int CalledBefore=0;
  496.  
  497.      IMP.Func = InitMidi;
  498.      IMP.DeviceID = 1;
  499.      IMP.IOport = 0x0388;
  500.      IMP.PercCh = 9;
  501.      IMP.ChMask = 0x023F;
  502.      IMP.Flags = 0;
  503.      rez = RUCKMIDI(&IMP);
  504.      if (rez == 0)
  505.  
  506.         // check to make sure that this is the first AtExitMidi call
  507.  
  508.         if (CalledBefore == 0)
  509.            XMP.Func = AtExitMidi;
  510.            rez = RUCKMIDI(&XMP);
  511.  
  512.            if (rez == 0)
  513.               CalledBefore = -1;
  514.            else
  515.               printf("_atexit unable to register ExitMidi");
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.                                                                                8
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.      LoadMidi            Func: 4        Pack: LoadMidiPack
  536.  
  537.  
  538.      Use to load MIDI data into DOS memory. While you may use your own memory
  539.      allocation and DOS file routines to load MIDI data, LoadMidi automates this
  540.      task.
  541.  
  542.      LoadMidi makes memory allocations directly from the operating system pool*.
  543.      This means that before using LoadMidi DOS must have enough available memory
  544.      to into which to load the file. 
  545.  
  546.           Note: In Borland C compilers, memory allocations made via DOS INT21/48
  547.           cannot be used when any _malloc() call is made. Doing so corrupts the
  548.           _malloc() chain. This is strictly a Borland problem. To overcome this
  549.           limitation, you must use the memory module patch, MIDMEMBC.OBJ.
  550.  
  551.      LoadMidi manages up to 32 files in memory at one time, given sufficient
  552.      RAM. LoadMidi can also seek into a given file at any position and start
  553.      loading from that position for any number of bytes. This lets you
  554.      concatenate several MIDI data files into one and load any or all of the
  555.      internal MIDI data streams into memory. In addition, you can load the
  556.      entire file into memory and, by using pre-calculated memory offsets, start
  557.      MidiPlay at any of the MIDI data streams. 
  558.  
  559.      LoadMidi performs no format checking. Format checking is done by MidiPlay.
  560.  
  561.      Once a file has been loaded by LoadMidi, you can release the memory used by
  562.      the file by using DeallocMidi. See that routine for more.
  563.  
  564.      Sample Use:
  565.  
  566.      struct LoadMidiPack LMP;  // for multiple concurrent loads 
  567.                                // use LMP[NumOfLoads]...
  568.  
  569.      LMP.Func = LoadMidi;
  570.      LMP.FilenamePtr = filename;
  571.      LMP.StartPos = 0L;    // start load at first byte of file
  572.      LMP.LoadSize = 0L;    // when=0 entire file is loaded into memory
  573.      rez = RUCKMIDI(&LMP);
  574.      if (rez == 0)
  575.         // LMP.LoadPtr is address of load and used by MidiPlay
  576.         // Note: _FP_OFF(LMP.LoadPtr) is always returned=0
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.                                                                                9
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.      PlayMidi            Func: 5        Pack: PlaybackMidiPack
  602.  
  603.  
  604.      Once MIDI data is in memory, you can begin play. Play is done as a
  605.      background task allowing other operations, such as screen updating or file
  606.      loading, to continue. Once you begin play, it plays itself. You need only
  607.      check the end of play status to determine when a MIDI stream has completed
  608.      play. All other aspects of MIDI play is handled by RUCKUS-MIDI.
  609.  
  610.      A routine also available in RUCKUS-MIDI is OutMsgMidi. You can use
  611.      OutMsgMidi to issue MIDI channel messages directly. 
  612.  
  613.      File format type is checked by PlayMidi. To determine file format before
  614.      actual play see FastFwdMidi. Note that ROL-converted MIDI files (via
  615.      ROL2MIDI.EXE) and CMF files can only be played (correctly) when using the
  616.      OPL-2 or -3 chip (on AdLib-compatibles such as SB, PAS, SB Pro, etc.). ROL-
  617.      cnv MIDI files do not contain program change messages, and CMF files have a 
  618.      self-contained program patch map. 
  619.  
  620.      Sample Use:
  621.  
  622.      struct PlaybackMidiPack PBMP;  // LMP and DMP assumed defined
  623.  
  624.      PBMP.Func = PlayMidi;
  625.      PBMP.Mode = 1;         // this must be 1 for background play
  626.                             // foreground mode is not supported 
  627.      PBMP.LoadPtr = LMP.LoadPtr // LoadPtr from LoadMidi
  628.      rez = RUCKMIDI(&PBMP);
  629.      if (rez == 0)
  630.         
  631.         // the MIDI data is being played in the background
  632.         // at this point you can do anything you want
  633.         // for this example we just wait for the end status to become true
  634.         // see Appendix D. for information on the RUCKUS-MIDI data area
  635.  
  636.         do
  637.             ;
  638.         while (MIDIDATA.End == 0);
  639.  
  640.         XMP.Func = EndMidi;     // EndMidi should be called whenever
  641.         rez = RUCKMIDI(&XMP);   // a MIDI tune is has ended
  642.  
  643.         // if no further use for this MIDI data, release the memory it uses
  644.         // see DeallocMidi for more information
  645.  
  646.         DMP.Func = DeallocMidi;
  647.         DMP.HandSeg = _FP_SEG(LMP.LoadPtr);
  648.         DMP.TypeFlag = 0;
  649.         rez = RUCKMIDI(&DMP);
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.                                                                               10
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.      EndMidi             Func: 8        Pack: XitMidiPack
  668.  
  669.  
  670.      Use to stop play of the initialized device. EndMidi is similar in function
  671.      to ExitMidi except that it does not release any memory. It does not
  672.      completely shut down the initialized device but it does restore hooked
  673.      interrupts.
  674.  
  675.      EndMidi can be thought of as a stop button, whereas ExitMidi is more like
  676.      the on/off switch.
  677.  
  678.      Sample Use:
  679.  
  680.      struct XitMidiPack XMP;
  681.  
  682.      // MIDI tune has play and is over, perform EndMidi to restore hooked
  683.      // interrupts and silence device
  684.  
  685.      XMP.Func = EndMidi;
  686.      rez = RUCKMIDI(&XMP);
  687.  
  688.      // now continue with program such as load next tune, play, etc.
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.                                                                               11
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.      PauseMidi           Func: 9        Pack: PauseMidiPack
  734.  
  735.  
  736.      Use to pause or unpause currently playing MIDI data. There is no effect if
  737.      no data is currently playing.
  738.  
  739.      Sample Use:
  740.  
  741.      struct PauseMidiPack PMP;
  742.  
  743.      // pause or unpause depending on state of DoPause flag
  744.  
  745.      PMP.Func = PauseMidi;
  746.      PMP.Pause = 1;
  747.      rez = RUCKMIDI(&PMP);
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.                                                                               12
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.      DeallocMidi         Func: 10       Pack: DeallocMidiPack
  800.  
  801.  
  802.      Use to release memory used by LoadMidi. Once a file has been loaded via
  803.      LoadMidi, the memory used by that load is not available for other loads
  804.      until you release it using DeallocMidi. 
  805.  
  806.      If you will only be needing one MIDI data stream in memory at a time you
  807.      can load as many files as you want using only the memory needed by the
  808.      largest file loaded (i.e., reuse the memory). For example, let's say that
  809.      you have 40 separate MIDI data files that you will be playing. A simple
  810.      method to load these is to free up 64K (single MIDI file max for RUCKUS-
  811.      MIDI), LoadMidi a MIDI file, play it through, DeallocMidi the memory it
  812.      used, LoadMidi the next MIDI file, play it through, DeallocMidi, and so on.
  813.      This technique can also be used to LoadMidi into one concatenated file.
  814.      This requires that you pre-calculate at what offset each MIDI data stream
  815.      starts and its size. 
  816.  
  817.      DeallocMidi is called automatically by ExitMidi.
  818.  
  819.      Sample Use:
  820.  
  821.      struct DeallocMidiPack DMP;
  822.  
  823.      DMP.Func = DeallocMidi;
  824.      DMP.HandSeg = _FP_SEG(LMP.LoadPtr);  // as set by LoadMidi
  825.      DMP.TypeFlag = 0;                    // must be = 0
  826.      rez = RUCKMIDI(&DMP);
  827.      if (rez == 9)
  828.         printf("Invalid LMP.LoadPtr, Not a fatal error");
  829.         // means that LMP.LoadPtrSeg is not valid
  830.         // perhaps it's already been deallocated by ExitMidi
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.                                                                               13
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.      FastFwdMidi         Func: 11       Pack: FastFwdMidiPack
  866.  
  867.  
  868.      A standard MIDI file is a series of MIDI messages that are sequenced by
  869.      based on timings within the file. Each MIDI message is preceded by a tick
  870.      count that informs MIDI-RUCKUS when to output each particular message.
  871.  
  872.      FastFwdMidi instructs RUCKUS-MIDI to disregard all timing information up to
  873.      the specified tick count. It also mutes the output so no sound is produced.
  874.      The actual fast forward does not take place until the PlayMidi function is
  875.      called. After using FastFwdMidi, you must call FastFwdMidi again with
  876.      FFMP.TickCount=0L to turn off fast-forward mode.
  877.  
  878.      One use of FastFwdMidi is determine the running time of a MIDI file.
  879.  
  880.      Sample Use:
  881.  
  882.      struct FastFwdMidiPack FFMP;
  883.  
  884.      FFMP.Func = FastFwdMidi;   // Given the MIDI data is already in memory...
  885.      FFMP.TickCount = 0xFFFFFFFF; // set to fast-fwd all the way through
  886.      rez = RUCKMIDI(&FFMP);
  887.      if (rez == 0) {
  888.         PBMP.Func = PlayMidi;     // play but in fast fwd mode
  889.         PBMP.Mode = 1;
  890.         PBMP.LoadPtr = LMP.LoadPtr;
  891.         rez = RUCKMIDI(&PBMP);
  892.         if (rez == 0) {
  893.  
  894.            do
  895.                ;
  896.            while (MIDIDATA.End == 0);   // wait until done
  897.            
  898.            // TotalTicks& is the tick count at the end the last MIDI message
  899.            // --also need Ticks/quarternote and microseconds/quarternote
  900.  
  901.            TotalTicks = MIDIDATA.TickCount;
  902.            TicksQnote = MIDIDATA.TicksQnote;
  903.            uSecsQnote = MIDIDATA.uSecsQnote;
  904.  
  905.            TimeInSecs = ((uSecsQnote/10)*(TotalTicks/TicksQnote))/100000;
  906.  
  907.            FFMP.Func = FastFwdMidi;
  908.            FFMP.TickCount = 0L;         // set FastFwdMidi off
  909.            rez = RUCKMIDI(&FFMP);
  910.  
  911.      To fast forward in small increments while the MIDI data is playing, first
  912.      get the current TickCount, add to it the number of ticks to skip, and use
  913.      that as the FFMP.TickCount. If FFMP.TickCount > TotalTicks then do not
  914.      perform the fast forward since it would be past the end of data.
  915.  
  916.  
  917.  
  918.  
  919.  
  920.                                                                               14
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.      OutMsgMidi          Func: 12       Pack: OutMsgMidiPack
  932.  
  933.  
  934.      OutMsgMidi lets you send MIDI channel messages directly to the channel
  935.      message parser without needing to use PlayMidi. Whereas PlayMidi deals with
  936.      all aspects of playing a MIDI stream, such as interrupt setup, timing
  937.      control and other events required to process the MIDI data, OutMsgMidi
  938.      provides access to only the channel message parser of RUCKUS-MIDI.
  939.  
  940.      MIDI channel messages (composed of channel voice and mode messages) are
  941.      those that control the actual sound output. The current MIDI 1.0
  942.      specification specifies eight message groups, each identified by a status
  943.      byte and followed by one or two data bytes. See Appendix E. for more
  944.      information on MIDI channel messages, key numbers and frequencies.
  945.  
  946.      Obvious use of OutMsgMidi is for sound effects. Notes can be sounded,
  947.      volumes adjusted, programs (instruments) selected and fine-tuned, and sound
  948.      can be turned off.
  949.  
  950.      When outputting to a channel be aware that NoteOn messages will not sound
  951.      if the channel is already in a NoteOn. I.e., each NoteOn should have a
  952.      corresponding NoteOff (or NoteOn with velocity=0).
  953.  
  954.      Sample Use:
  955.  
  956.      struct OutMsgMidiPack OMMP;
  957.  
  958.      OMMP.Func = OutMsgMidi;
  959.      OMMP.Mstatus = 0x80;     // channel 0, NoteOn
  960.      OMMP.Mdata = 0x7F3C      // sound middle-C (3Fh=60d) at max vol (7Fh=127d)
  961.      rez = RUCKMIDI(&OMMP);
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.                                                                               15
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.      SetAllMidi          Func: 20       Pack: SetMidiPack
  998.  
  999.  
  1000.      While MIDI editing is best done on the MIDI data file itself with a
  1001.      sequencer/editor, RUCKUS-MIDI provides relative volume and tone adjustment
  1002.      to the MIDI data stream. Also, you may select the MIDI program/patch map to
  1003.      use. The channel mask as set in InitMidi may also be adjusted. You may also
  1004.      call each of these routines separately (see following SetMidi routines).
  1005.      For information on setting the patch map, set SetPatchMidi.
  1006.  
  1007.      The relative volume and tone adjustments let you boost or cut the playback
  1008.      levels of any or all of the MIDI channels (0-15). For example, if the MIDI
  1009.      data file has a trumpet playing to low on channel 4, you can boost channel
  1010.      4's relative volume so that the trumpet plays louder. Volume adjustment
  1011.      takes effect immediately.
  1012.  
  1013.      Tone adjustment allows you to adjust the notes being sounded in any or all
  1014.      of the channels. For example, if you want to have the notes sound on
  1015.      channel 5 play an octave lower, you adjust channel 5's relative tone by -
  1016.      12. Two octaves lower adjust by -24; an octave higher, adjust by +12; so
  1017.      on. Tone adjustment takes effect on the next sounded note.
  1018.  
  1019.      For adjusting relative levels you must designate which channels to operate
  1020.      on. SMP.Channel is a bit-mapped mask used to identify which channels. Each
  1021.      MIDI channel (0-15) has a corresponding bit in SMP.Channel. Channel 0 has
  1022.      SMP.Channel bit 0 as its mask; channel 1, bit 1; so on. For example, for
  1023.      this call to affect only channel 0, set SMP.Channel = 1. For only MIDI
  1024.      channel 1, use 2. For both channels 0 and 1, use 3.
  1025.  
  1026.      Sample Use:
  1027.  
  1028.      struct SetMidiPack SMP;
  1029.  
  1030.      SMP.Func = SetAllMidi;
  1031.      SMP.Channel = 0x21;       // adjust channels 0 and 5 only
  1032.      SMP.Channel = 13;         // increase those channels' volumes by 13
  1033.      SMP.Tone = 0;             // no adjustments for tone
  1034.      SMP.ChMask = IMP.ChMask;  // use same channels as at InitMidi
  1035.      SMP.PatchMapID = 1;       // use internal MT-32 program map
  1036.      SMP.PatchMapPtr = NULL;   // since using internal map this should be=0
  1037.                                // (see SetPatchMidi for more on PatchMapID)
  1038.      rez = RUCKMIDI(&SMP);
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.                                                                               16
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.      SetVolumeMidi       Func: 21       Pack: SetMidiPack
  1064.  
  1065.  
  1066.      The relative volume adjustment lets you boost or cut the playback volume
  1067.      level of any or all of the MIDI channels (0-15). For example, if the MIDI
  1068.      data file has a trumpet playing to low on channel 4, you can boost channel
  1069.      4's relative volume so that the trumpet plays louder. Volume adjustment
  1070.      takes effect immediately. Any relative increase in volume level will not
  1071.      exceed the maximum level allowed, i.e., if the trumpet is already playing
  1072.      at its maximum volume, any positive relative adjustment will have no
  1073.      effect.
  1074.  
  1075.      For adjusting relative volume you must designate which channels to operate
  1076.      on. SMP.Channel is a bit-mapped mask used to identify which channels. Each
  1077.      MIDI channel (0-15) has a corresponding bit in SMP.Channel. See SetAllMidi
  1078.      on how to do this.
  1079.  
  1080.      Level adjustment range is -128 to 127.
  1081.  
  1082.      Sample Use:
  1083.  
  1084.      struct SetMidiPack SMP;
  1085.  
  1086.      SMP.Func = SetVolumeMidi;
  1087.      SMP.Channel = 0x31;      // adjust channels 0, 4 and 5 only
  1088.      SMP.Volume = 127;        // play those channels always at max volume
  1089.      rez = RUCKMIDI(&SMP);
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.                                                                               17
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.      SetToneMidi         Func: 22       Pack: SetMidiPack
  1130.  
  1131.  
  1132.      Tone adjustment allows you to adjust notes being sounded in any or all of
  1133.      the channels. For example, if you want to have the notes sound on channel 5
  1134.      play an octave lower, adjust channel 5's relative tone by -12. Two octaves
  1135.      lower adjust by -24; an octave higher, adjust by +12; so on. Tone
  1136.      adjustment takes effect on the next sounded note. For more on note numbers
  1137.      and their relationship to notes and octaves, see Appendix E. 
  1138.  
  1139.      For adjusting relative tone you must designate which channels to operate
  1140.      on. SMP.Channel is a bit-mapped mask used to identify which channels. Each
  1141.      MIDI channel (0-15) has a corresponding bit in SMP.Channel. See SetAllMidi
  1142.      on how to do this.
  1143.  
  1144.      Level adjustment range is -128 to 127.
  1145.  
  1146.      Sample Use:
  1147.  
  1148.      struct SetMidiPack SMP;
  1149.  
  1150.      SMP.Func = SetToneMidi;
  1151.      SMP.Channel = 1;         'adjust channel 0 only
  1152.      SMP.Tone = -12;          'play notes on that channel one octave lower    
  1153.      rez = RUCKMIDI(&SMP);
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.                                                                               18
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.      SetPatchMidi        Func: 23       Pack: SetMidiPack
  1196.  
  1197.  
  1198.      MIDI specifies instruments by number (0-127). These instruments are often
  1199.      called programs, or patches. The one big incompatibility among MIDI data
  1200.      files is correspondence of instrument number to instrument sound. Up to
  1201.      just a few years ago, there was no standard, so that files made by one
  1202.      sequencer often sounded totally wrong when played on another. Ideally,
  1203.      there would be only one program map that all MIDI used, but that would be
  1204.      to restrictive to musicians. Because of this lack of standard, the
  1205.      International MIDI Association (IMA) created what is know as the General
  1206.      MIDI Sound Set. This is a standardized set of programs that map instrument
  1207.      numbers to known instrument sounds. It also standardizes the percussion
  1208.      map. 
  1209.  
  1210.      The percussion map is similar to the main sound set but is used to sound a
  1211.      wide range of percussive instruments (the main sound set is nearly all
  1212.      melodic instruments). The percussion map takes note numbers that are output
  1213.      on a certain channel (channel 9 by standard (0-based)) and maps that note
  1214.      number to a particular percussive sound. For example, note 60 when played
  1215.      on any channel but the percussion channel plays a middle-C on whatever the
  1216.      current instrument program is for that channel. However, when note number
  1217.      60 is played on the percussion channel, it maps to the Hi Bongo. Note
  1218.      number 35 maps to the bass drum. See Appendix F. for the General MIDI Sound
  1219.      Set description.
  1220.  
  1221.      In addition to the General MIDI (GM) set, RUCKUS-MIDI also maps to the MT-
  1222.      32 sound set. Many MIDI files have been sequenced to the MT-32 set (see
  1223.      Appendix G. for the MT-32 sound set). In the future, you'll find more and
  1224.      more files sequenced to General MIDI. Microsoft Windows Multimedia
  1225.      specifies General MIDI as its sound set. RUCKUS-MIDI uses the GM map by
  1226.      default.
  1227.  
  1228.      For those MIDI files that do not comply with either GM or MT-32, RUCKUS-
  1229.      MIDI allows for custom patch maps to be used. See Appendix H. for custom
  1230.      patch map specifications and implementation notes. Be aware, however, that
  1231.      custom patch maps (those created by you) are device dependent. This means
  1232.      that you need a separate custom patch map for each device you intend to
  1233.      support. The internal RUCKUS-MIDI patch maps will always be device-
  1234.      independent, in that all current and future devices supported by RUCKUS-
  1235.      MIDI will have a GM and an MT-32 map available.
  1236.  
  1237.      Sample Use:
  1238.  
  1239.      struct SetMidiPack SMP;
  1240.  
  1241.      SMP.Func = SetPatchMidi;
  1242.      SMP.PatchMapID = 1;       // 1=MT-32 (0=GM and -1 means use custom map)
  1243.      SMP.PatchMapPtr = NULL;
  1244.      rez = RUCKMIDI(&SMP);
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.                                                                               19
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.      SetChMaskMidi       Func: 24       Pack: SetMidiPack
  1262.  
  1263.  
  1264.      SetChMaskMidi adjusts the same channel mask as that specified for InitMidi.
  1265.  
  1266.      There are 16 MIDI channels, numbered 0 to 15 in RUCKUS-MIDI (sometimes seen
  1267.      numbered 1-16). Each channel can be used to play a particular program, or
  1268.      instrument (sometimes called a voice). For example, say a MIDI file playing
  1269.      "Street Fight" is sequenced for piano and guitar. Each instrument could be
  1270.      played at the same time providing that there is a channel available for
  1271.      each. Since there are only 2 instruments and 16 MIDI channels, that's no
  1272.      problem. Further, let's say that, later, you don't want to hear the piano
  1273.      voice. By using SetChMaskMidi, you can selectively turn off the piano
  1274.      channel (channel 0, or whichever channel it's on). 
  1275.  
  1276.      SetChMaskMidi also has another important use. It can be used to turn off
  1277.      channels that are not supported by the currently selected device. For
  1278.      example, the AdLib MSC in percussive mode (RUCKUS-MIDI deviceID 1) does not
  1279.      support channels 6 to 8, and 10 to 15. These channels are not supported
  1280.      because there are not sufficient voices available on that device. These
  1281.      channels (6-8, 10-15) should be masked out so that they are not processed.
  1282.  
  1283.      In addition to turning off channels that cannot be supported due to lack of
  1284.      voices, it may also be necessary to turn off MIDI channels due to the way
  1285.      the MIDI file has been sequenced. In particular, Microsoft Windows
  1286.      Multimedia Specification dictates that MIDI files be sequenced redundantly.
  1287.      Channels 0 to 9 are for so-called extended synthesizers, and channels 12 to
  1288.      15 are for so-called base-level synthesizers. In either case, the highest
  1289.      channel (9 and 15, respectively) is used for the percussive channel. The
  1290.      specification also states that the most important channels be the lower-
  1291.      numbered (respective their synthesizer level). In RUCKUS-MIDI, such
  1292.      redundant MIDI files should always be played as if an extended synthesizer
  1293.      is active (channels 0 to 9) and the base-level redundant channels (12 to
  1294.      15, as well as channels 10 and 11) should be masked out.
  1295.  
  1296.      SMP.ChMask is a bitmapped mask, 1 bit for each channel. See SetAllMidi for
  1297.      an example in how to determine the value to use for SMP.ChMask.
  1298.  
  1299.      Sample Use:
  1300.  
  1301.      struct SetMidiPack SMP;
  1302.  
  1303.      SMP.Func = SetChMaskMidi;
  1304.      SMP.ChMask = 3;           // turn off all channels except 0 and 1
  1305.      rez = RUCKMIDI(&SMP);
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.                                                                               20
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.      SetAllFMSBP         Func:30        Pack: SetFMProPack
  1328.  
  1329.  
  1330.      Though RUCKUS-MIDI is intended and is designed to be device independent,
  1331.      there will be need for access to device-dependant features. The Sound
  1332.      Blaster Pro, for example, has an on-board mixer facility that controls FM
  1333.      chip volume. By default, the SB Pro is set to half-volume, much too low for
  1334.      typical use. By using SetAllFMSBP you can set the FM volume to maximum and
  1335.      let the actual sound volume be controlled via the MIDI data itself.
  1336.  
  1337.      In addition to the basic volume settings, you can also adjust the steering.
  1338.      Steering turns off either the left, right, or both channels. On late-model
  1339.      SB Pro cards, the independent left and right FM channel volumes can be used
  1340.      for better effect (smoother panning). Early-model SB Pros may not have the
  1341.      independent left/right volume adjustments and so steering is used to shift
  1342.      (all) sound left or right. The steering can also be set to mute the FM
  1343.      output. You may find that muting the SB Pro before InitMidi and before
  1344.      EndMidi results in a smoother sound and song transition.
  1345.  
  1346.      There is no Sound Blaster Pro detection routine available in RUCKUS-MIDI
  1347.      since the only device currently supported is the basic FM chip, originally
  1348.      used by the AdLib MSC (which is what the Sound Blaster and other
  1349.      compatibles use). Any device supporting the AdLib at I/O port 388h is
  1350.      detected. When OPL-3 (a super-set of the AdLib chip used by the SB Pro and
  1351.      others) support is added, additional detection routines for it will be
  1352.      included. Using SetAllFMSBP with no SB Pro installed should not present any
  1353.      problems, however, for absolute determination of an SB Pro device, use the
  1354.      detection routines in RUCKUS-DAC.
  1355.  
  1356.      The SB Pro base address I/O port is currently selectable at either 220h
  1357.      (the SB Pro default) or at 240h. Use RUCKUS-DAC for absolute determination.
  1358.      The master volume adjusts the Pro's master volume (also adjustable in
  1359.      RUCKUS-DAC). To low byte of SFMPP.MastVol sets the left channel's volume.
  1360.      The high byte sets the right channel's. Range for each is 1 to 15, odd
  1361.      values only. To set the right channel, multiply the volume by 256, e.g.,
  1362.      SFMPP.MastVol = (256 * RtChVol) + LfChVol. To not change the master volume,
  1363.      set to -1. SFMPP.FMvol has the same range and is set the same way. It
  1364.      cannot be skipped. Steering, described above, can also be skipped by
  1365.      setting SFMPP.Steer to -1. It's practical use is to mute output during
  1366.      InitMidi and during an abrupt EndMidi (abrupt EndMidi meaning ending a
  1367.      MidiPlay before the actual end of data and notes may still be sounding).
  1368.  
  1369.      Sample Use:
  1370.  
  1371.      struct SetFMProPack SFMPP;
  1372.  
  1373.      SFMPP.Func = SetAllFMSBP;
  1374.      SFMPP.IOport = 0x220;     // base port of SB Pro (220h or 240h)
  1375.      SFMPP.MasterVol = 0x0F0F; // low byte=left,high=right,-1=no change
  1376.      SFMPP.Steer = 0;          // 0=none,1=left,2=right,3=mute,-1=no change
  1377.      SFMPP.FMvol = 0x0F0F;     // low byte=left,high=right (cannot skip)
  1378.      rez = RUCKMIDI(&SFMPP);
  1379.  
  1380.  
  1381.  
  1382.                                                                               21
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.      Appendix A. Tips and Tricks.
  1394.  
  1395.  
  1396.      1. Noise Abatement.
  1397.  
  1398.      If a Sound Blaster Pro is known to be available and is used as the MIDI
  1399.      device, noise can be minimized by setting the FM volume to 0, or by muting
  1400.      the FM steering. It can also be used when abruptly ending a MIDI playback
  1401.      before actual end of data. If no SB Pro is available, setting all MIDI
  1402.      relative volumes to -128 should reduce any spurious noise.
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.                                                                               22
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.      Appendix B. RUCKUS-MIDI Pack Structure.
  1460.  
  1461.      #pragma pack(1)
  1462.  
  1463.      int far pascal RUCKMIDI(void far *datapack);
  1464.  
  1465.      #define SysInfoMidi     0
  1466.      #define InitMidi        1
  1467.      #define ExitMidi        2
  1468.      #define AtExitMidi      3
  1469.      #define LoadMidi        4
  1470.      #define PlayMidi        5
  1471.  
  1472.      #define EndMidi         8
  1473.      #define PauseMidi       9
  1474.      #define DeallocMidi     10
  1475.      #define FastFwdMidi     11
  1476.      #define OutMsgMidi      12
  1477.  
  1478.      #define SetAllMidi      20
  1479.      #define SetVolumeMidi   21
  1480.      #define SetToneMidi     22
  1481.      #define SetPatchMidi    23
  1482.      #define SetChMaskMidi   24
  1483.  
  1484.      #define SetAllFMSBP     30
  1485.  
  1486.      /* current highest function is 30 */
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.                                                                               23
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.      struct DeallocMidiPack { /* DMP */
  1526.       unsigned Func;
  1527.       int Stat;
  1528.       unsigned HandSeg;      /* RUCKUS allocates DOS memory */
  1529.       unsigned TypeFlag;     /* 0=DOS para */
  1530.      }; /* 8 */
  1531.  
  1532.      struct FastFwdMidiPack { /* FFMP */
  1533.       unsigned Func;
  1534.       int Stat;
  1535.       long TickCount;
  1536.      }; /* 8 */
  1537.  
  1538.      struct GetDataMidiPack { /* GDMP */
  1539.       unsigned Func;
  1540.       int Stat;
  1541.       unsigned long BytePos; /* current byte relative base ptr */
  1542.      }; /* 8 */
  1543.  
  1544.      struct InitMidiPack {   /* IMP */
  1545.       unsigned Func;
  1546.       int Stat;
  1547.       unsigned DeviceID;     /* 0=OPL-2 melodic,1=OPL-2 percussive */
  1548.       unsigned IOport;
  1549.       unsigned PercCh;       /* percussive channel (0-based) */
  1550.       unsigned ChMask;       /* bitmapped */
  1551.       unsigned Flags;        /* see Appendix D. */
  1552.       void far *InfoPtr;     /* ret:far ptr to RUCKMIDI info */
  1553.       void far *MidiExitPtr; /* ret:far ptr to ExitMidi routine */
  1554.      }; /* 22 */
  1555.  
  1556.      struct LoadMidiPack {   /* LMP */
  1557.       unsigned Func;
  1558.       int Stat;
  1559.       void far *FilenamePtr;/* far ptr to filenameZ to load */
  1560.       unsigned long StartPos; /* offset into file to start load at */
  1561.       unsigned long LoadSize; /* number of bytes to load (or 0 for autosize) */
  1562.       void far *LoadPtr;    /* ret:DOS seg:offset (offset always 0) */
  1563.      }; /* 20 */
  1564.  
  1565.      struct OutMsgMidiPack { /* OMMP */
  1566.       unsigned Func;
  1567.       int Stat;
  1568.       unsigned Mstatus;      /* status byte (8n, 9n, ... En) */
  1569.       unsigned Mdata;
  1570.      }; /* 8 */
  1571.  
  1572.      struct PlaybackMidiPack { /* PBMP */
  1573.       unsigned Func;
  1574.       int Stat;
  1575.       unsigned Mode;         /* mode (0=interrupt FG,1=BG) */
  1576.       void far *LoadPtr;   /* seg:off to start of data to play */
  1577.      }; /* 10 */
  1578.  
  1579.  
  1580.                                                                               24
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.      struct PauseMidiPack {  /* PMP */
  1593.       unsigned Func;
  1594.       int Stat;
  1595.       unsigned Pause;        /* 0=unpause else pause */
  1596.      }; /* 6 */
  1597.  
  1598.      struct SetPack {        /* SP */
  1599.       unsigned Func;
  1600.       int Stat;              /* (if volume=0 SB speaker off'ed else on'ed) */
  1601.       unsigned Volume;       /* volume (left ch=MSB,right=LSB) (0-127,0-127) */
  1602.       unsigned IntRate;      /* playback interrupt rate (5000-23000) */
  1603.       unsigned Priority;     /* priority level (0-2, default=1) */
  1604.      }; /* 10 */
  1605.  
  1606.      struct SetFMProPack {   /* SFMPP */
  1607.       unsigned Func;
  1608.       int Stat;
  1609.       unsigned IOport;       /* base I/O port (0x220, 0x240) */
  1610.       int MasterVol;         /* 0xF0F=max(low byte=right,hi=left,-1=nochange)*/
  1611.       int Steer;             /* 0=none,1=left,2=right,3=mute,-1=no change */
  1612.       unsigned FMvol;        /* as MasterVol but cannot skip (i.e.cannot=-1)*/
  1613.      }; /* 12 */
  1614.  
  1615.      struct SetMidiPack {     /* SMP */
  1616.       unsigned Func;
  1617.       int Stat;
  1618.       unsigned Channel;      /* channel to set (bit mask of channels 0-15) */
  1619.       int Volume;            /* volume adjust */
  1620.       int Tone;              /* tone adjust */
  1621.       unsigned ChMask;       /* if bit=0 then that channel ignored */
  1622.       int PatchMapID;        /* patch map ID */
  1623.       void far *PatchMapPtr; /* farptr to alt patch/ret:addr of PatchMapID*/
  1624.      }; /* 18 */
  1625.  
  1626.      struct SysInfoMidiPack { /* SIMP */
  1627.       unsigned Func;
  1628.       int Stat;
  1629.       unsigned Device0;    /* =1 if OPL-2 melodic mode available */
  1630.       unsigned D0port;     /* 0x388 */
  1631.       unsigned D0mask;     /* available channel mask for SMP.ChMask */
  1632.       unsigned Device1;    /* =1 if OPL-2 percussive mode available */
  1633.       unsigned D1port;
  1634.       unsigned D1mask;
  1635.      }; /* 16 */
  1636.  
  1637.      struct XitMidiPack {    /* XMP */
  1638.       unsigned Func;
  1639.       int Stat;
  1640.      }; /* 4 */
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.                                                                               25
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.      Appendix C. Compiler, Linker and Call Use.
  1658.  
  1659.      Consult your development system's documentation on the use of external
  1660.      library files. For call use, see the example X*.c files.
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.                                                                               26
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.      Appendix D. RUCKUS-MIDI Data Area.
  1724.  
  1725.      To access the MIDI data area in your code:
  1726.  
  1727.           extern struct MidiDataArea pascal MIDIDATA;
  1728.           :
  1729.           printf("MIDIDATA DeviceID is %u", MIDIDATA.DeviceID);
  1730.  
  1731.  
  1732.      /* MIDI data area structure */
  1733.  
  1734.      #pragma pack(1)   /* ALL Ruckus data structures MUST be byte-aligned */
  1735.  
  1736.      struct MidiDataArea {
  1737.       unsigned DeviceID;     /*+0    ;0=AdLib melodic, 1=AdLib percussive... */
  1738.       unsigned Flags;        /* 2    ;bit0=1 use background processing */
  1739.                              /*      ;bit1=1 disable program change event */
  1740.                              /*      ;bit2-7 reserved (low byte used to send */
  1741.                              /*      ;while high byte used to return info) */
  1742.                              /*      ;bit8-13 reserved */
  1743.                              /*      ;bit14=1 then CTMF file playing */
  1744.                              /*      ;bit15=1 then AdLib ROL-convert */
  1745.       unsigned PercChannel;  /* 4    ;<> 0 percussion channel mapped to here */
  1746.       unsigned End;          /* 6    ;=1 end of MIDI (not playing) */
  1747.       unsigned MemDOS;       /* 8    ;DOS RAM available */
  1748.       unsigned MemUsed;      /* 10   ;K used by last load */
  1749.       unsigned TypeMIDI;     /* 12   ;MIDI type (0 or 1) */
  1750.       unsigned NoTracks;     /* 14   ;number of tracks */
  1751.       unsigned TicksQnote;   /* 16   ;ticks/quarter-note */
  1752.  
  1753.       unsigned long uSecsQnote;/* 18   ;micro-secs/quarter-note */
  1754.       unsigned long TickCount; /* 22   ;current tick count */
  1755.  
  1756.       void far *MusicPtr;  /* 26   ;farptr to current MIDI data byte */
  1757.       unsigned CurrTrk;      /* 30   ;current MIDI track */
  1758.       char TimeSig[4];       /* 32   ;nm,dn,MIDI clocks/beat,32nd notes/beat */
  1759.       char ChPrograms[16];   /* 36   ;channel programs */
  1760.       char ChVolumes[16];    /* 52   ;channel volume level (0-127) */
  1761.       char ChNotes[16];      /* 68   ;channel note values (0-127) */
  1762.  
  1763.       unsigned ChRelVolumes[16];/* 84   ;-128 to +127 range (0=no change) */
  1764.       unsigned ChRelNotes[16];  /* 116  ;-128 to +127 range (0=no change) */
  1765.      };
  1766.  
  1767.      #pragma pack()
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.                                                                               27
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.      Appendix E. MIDI Key Numbers, Frequencies and Channel Messages.
  1790.  
  1791.  
  1792.       Octave  1      2       3       4       5       6      7      8
  1793.       Note                    (frequency in Hertz)
  1794.        C   16.352  32.704  65.40  130.81  261.63  523.26  1046.5 2093
  1795.        C#  17.324  34.648  69.29  138.59  277.18  554.36  1108.7 2217
  1796.        D   18.354  36.708  73.41  146.83  293.66  587.32  1174.6 2349
  1797.        D#  19.445  38.890  77.78  155.56  311.12  622.24  1244.4 2489
  1798.        E   20.601  41.202  82.40  164.80  329.61  659.23  1318.4 2637
  1799.        F   21.826  43.652  87.30  174.60  349.21  698.43  1396.8 2794
  1800.        F#  23.124  46.248  92.49  184.99  369.98  739.96  1479.9 2960
  1801.        G   24.499  48.998  97.99  195.99  391.98  783.96  1567.9 3136
  1802.        G#  25.956  51.912 103.82  207.64  415.29  830.59  1661.1 3322
  1803.        A   27.500  55.000 110.00  220.00  440.00  880.00  1760.0 3520
  1804.        A#  29.135  58.270 116.54  233.08  466.16  932.32  1864.6 3729
  1805.        B   30.867  61.734 123.46  246.93  493.87  987.74  1975.4 3951
  1806.  
  1807.      Note C1 (16Hz) is MIDI key number 12, C2 (32Hz) is 24...C5 (261Hz) is 60,
  1808.      middle-C on the piano keyboard. Valid key number range is 12 to 107 (96 key
  1809.      numbers total). This is peculiar to the OPL-2 chip. MIDI key number range
  1810.      is 0 to 127. Key numbers issued > 107 are set to 107 and numbers < 12 are
  1811.      set to 12 when using the OPL-2 or -3.
  1812.  
  1813.      For accessing steps between notes, you can use the PitchBend MIDI channel
  1814.      message (OutMsgMidi status byte En, Pitch Wheel Change). Each 512-point
  1815.      adjustment to pitchbend results in a 1-step change, giving a pitchbend
  1816.      range of +/- 16 steps per half-tone (pitchbend range is 0 to 16383 with
  1817.      8192 equal to no change).
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.                                                                               28
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.      MIDI channels messages are what OutMsgMidi transmits to the MIDI parser.
  1857.      For complete specifications on MIDI channel messages, MIDI system messages,
  1858.      and the other details of the inner-workings of MIDI, contact the
  1859.      International MIDI Association (IMA) and ask for the MIDI 1.0
  1860.      Specification. Several volumes are available for sale ranging from detailed
  1861.      specs to the standard MIDI file format. The IMA's mailing address is:
  1862.  
  1863.           IMA - the International MIDI Association
  1864.           5316 W 57 ST
  1865.           LOS ANGELES CA 90056
  1866.           USA
  1867.  
  1868.      The MIDI channel messages are:
  1869.  
  1870.      Message Name           Mstat/Mdata Comment
  1871.      -----------------------------------------------------------------
  1872.      Note Off                 8n kn v   kn=key number (0-127)
  1873.                                         v =velocity (0-127) (volume)
  1874.      Note On                  9n kn v   kn=key number (0-127)
  1875.                                         v =velocity (1-127,0=note off)
  1876.      Polyphonic After-Touch   An kn v   kn=key number (0-127)
  1877.                                         v =velocity (0-127)
  1878.      Control Change           Bn cn x   cn=controller (0-121, 0-79h)
  1879.                                         x =value (0-127)
  1880.                                         (Control Change not implemented)
  1881.      Channel Mode:
  1882.         All Notes Off         Bn 7B 0   7B=channel n sound off
  1883.                                         (Other modes not implemented)
  1884.      Program Change           Cn p      p =program (0-127)
  1885.      Channel After-Touch      Dn v      v =velocity (0-127)
  1886.      Pitch Wheel Change       En lb hb  lb=low byte (0-127)*
  1887.                                         hb=high byte (0-127)
  1888.  
  1889.      *All non-status bytes must have the high-order bit of each byte unset. For
  1890.      Pitch Wheel Change (En lb hb) where there is to be no change, lb/hb is to
  1891.      be set to 00/40h (4000h=8192, center pitch). The low byte's MSB should not
  1892.      be set, meaning that, for example, 4080 to 40FF are not valid pitch bends.
  1893.      If 4080h is used RUCKUS-MIDI unsets the MSB of lb so that 4000h is used.
  1894.  
  1895.      All status bytes have the high-order bit set. The n nybble of each status
  1896.      byte (e.g., 8n) designates the channel number, 0 to F (0 to 15d). Most MIDI
  1897.      channel messages takes two data bytes, though some take only one. The order
  1898.      shown above is the order that should be used. For example, to send the
  1899.      channel message NoteOn/key# 32/max volume via OutMsgMidi for channel 3, set
  1900.      Mstatus to 93h and set Mdata to &H7F20 (low/high bytes=20/7Fh).
  1901.  
  1902.      The specification is rather complex. RUCKUS-MIDI builds upon those aspects
  1903.      of the specification that are useful in playing back MIDI data. Much of the
  1904.      MIDI specification deals with real-time performance and recording use,
  1905.      neither of which is RUCKUS-MIDI's intended purpose.
  1906.  
  1907.  
  1908.  
  1909.  
  1910.                                                                               29
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.      Appendix F. General MIDI Sound Set - Level 1.
  1922.  
  1923.      Sound Set Program Number and Name.
  1924.  
  1925.      Prog#  Instrument        Prog#  Instrument       Prog#  Instrument
  1926.      ---------------------------------------------------------------------
  1927.       0 ACOUSTIC GRAND PIANO   43 CONTRABASS           86 LEAD 7 fifths
  1928.       1 BRITE ACOUSTIC PIANO   44 TREMELO STRINGS      87 LEAD 8 bass+lead
  1929.       2 ELECTRIC GRAND PIANO   45 PIZZICATO STRINGS    88 PAD 1 new age
  1930.       3 HONKEYTONK             46 ORCHESTRAL HARP      89 PAD 2 warm
  1931.       4 ELECTRIC PIANO 1       47 TIMPANI              90 PAD 3 polysynth
  1932.       5 ELECTRIC PIANO 2       48 STRING ENSEMBLE 1    91 PAD 4 choir
  1933.       6 HARPSICHORD            49 STRING ENSEMBLE 2    92 PAD 5 bowed
  1934.       7 CLAVI                  50 SYNTHSTRINGS 1       93 PAD 6 metallic
  1935.       8 CELESTA                51 SYNTHSTRINGS 2       94 PAD 7 halo
  1936.       9 GLOCKENSPIEL           52 CHOIR AAHS           95 PAD 8 sweep
  1937.      10 MUSICBOX               53 VOICE OOHS           96 FX1 rain
  1938.      11 VIBRAPHONE             54 SYNTH VOICE          97 FX2 soundtrack
  1939.      12 MARIMBA                55 ORCHESTRA HIT        98 FX3 crystal
  1940.      13 XYLOPHONE              56 TRUMPET              99 FX4 atmosphere
  1941.      14 TUBULAR BELLS          57 TROMBONE            100 FX5 brightness
  1942.      15 DULCIMER               58 TUBA                101 FX6 goblins
  1943.      16 DRAWBAR ORGAN          59 MUTED TRUMPET       102 FX7 echoes
  1944.      17 PERCUSSIVE ORGAN       60 FRENCH HORN         103 FX8 sci-fi
  1945.      18 ROCK ORGAN             61 BRASS SECTION       104 SITAR
  1946.      19 CHURCH ORGAN           62 SYNTHBRASS 1        105 BANJO
  1947.      20 REED ORGAN             63 SYNTHBRASS 2        106 SHAMISEN
  1948.      21 ACCORDION              64 SOPRANO SAX         107 KOTO
  1949.      22 HARMONICA              65 ALTO SAX            108 KALIMBA
  1950.      23 TANGO ACCORDIAN        66 TENOR SAX           109 BAG PIPE
  1951.      24 ACOUSTIC GUITAR nyln   67 BARITONE SAX        110 FIDDLE
  1952.      25 ACOUSTIC GUITAR stl    68 OBOE                111 SHANAI
  1953.      26 ELECTRIC GUITAR jazz   69 ENGLISH HORN        112 TINKLE BELL
  1954.      27 ELECTRIC GUITAR cln    70 BASSOON             113 AGOGO
  1955.      28 ELECTRIC GUITAR mute   71 CLARINET            114 STEEL DRUMS
  1956.      29 OVERDRIVEN GUITAR      72 PICCOLO             115 WOOD BLOCK
  1957.      30 DISTORTION GUITAR      73 FLUTE               116 TAIKO DRUM
  1958.      31 GUITAR HARMONICS       74 RECORDER            117 MELODIC TOM
  1959.      32 ACOUSTIC BASS          75 PAN FLUTE           118 SYNTH DRUM
  1960.      33 ELECTRIC BASS finger   76 BLOWN BOTTLE        119 REVERSE CYMBAL
  1961.      34 ELECTRIC BASS pick     77 SHAKUHACHI          120 GUITAR FRET NOISE
  1962.      35 FRETLESS BASS          78 WHISTLE             121 BREATH NOISE
  1963.      36 SLAP BASS 1            79 OCARINA             122 LOSTINSPACE
  1964.      37 SLAP BASS 2            80 LEAD 1 square       123 BIRD TWEET
  1965.      38 SYNTH BASS 1           81 LEAD 2 sawtooth     124 TELEPHONE RING
  1966.      39 SYNTH BASS 2           82 LEAD 3 calliope     125 HELICOPTER
  1967.      40 VIOLIN                 83 LEAD 4 chiff        126 APPLAUSE
  1968.      41 VIOLA                  84 LEAD 5 charang      127 GUNSHOT
  1969.      42 CELLO                  85 LEAD 6 voice
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.                                                                               30
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.      General MIDI - Level 1 Sound Set Groupings by Program Number.
  1989.  
  1990.      Prog#   Instrument Group     Prog#  Ins Grp      Prog#  Ins Grp
  1991.      ---------------------------------------------------------------------
  1992.       0-7  Piano                  40-47 Strings       80-87  Synth Lead
  1993.       8-15 Chromatic Percussion   48-55 Ensemble      88-95  Synth Pad
  1994.      16-23 Organ                  56-63 Brass         96-103 Synth Effects
  1995.      24-31 Guitar                 64-71 Reed         104-111 Ethnic
  1996.      32-39 Bass                   72-79 Pipe         112-119 Percussive
  1997.                                                      120-127 Sound Effects
  1998.  
  1999.  
  2000.      General MIDI - Level 1 Percussion Map (Channel 9).
  2001.  
  2002.      Key#  Drum Sound       Key#  Drum Sound        Key#  Drum Sound
  2003.      --------------------------------------------------------------------
  2004.       35 Acoustic Bass Drum  51 Ride Cymbal 1        67 High Agogo
  2005.       36 Bass Drum 1         52 Chinese Cymbal       68 Low Agogo
  2006.       37 Side Stick          53 Ride Bell            69 Cabasa
  2007.       38 Acoustic Snare      54 Tambourine           70 Maracas
  2008.       39 Hand Clap           55 Splash Cymbal        71 Short Whistle
  2009.       40 Electric Snare      56 Cowbell              72 Long Whistle
  2010.       41 Low Floor Tom       57 Crash Cymbal 2       73 Short Guiro
  2011.       42 Closed Hi-Hat       58 Vibraslap            74 Long Guiro
  2012.       43 High Floor Tom      59 Ride Cymbal 2        75 Claves
  2013.       44 Pedal Hi-Hat        60 Hi Bongo             76 Hi Wood Block
  2014.       45 Low Tom             61 Low Bongo            77 Low Wood Block
  2015.       46 Open Hi-Hat         62 Mute Hi Conga        78 Mute Cuica
  2016.       47 Low-Mid Tom         63 Open Hi Conga        79 Open Cuica
  2017.       48 Hi-Mid Tom          64 Low Conga            80 Mute Triangle
  2018.       49 Crash Cymbal 1      65 High Timbal          81 Open Triangle
  2019.       50 High Tom            66 Low Timbal
  2020.  
  2021.  
  2022.      For timbre data used by RUCKUS-MIDI for programs 0-127 see the GMPATCH.*
  2023.      file. Also see that file for percussive voice mappings (for example, how
  2024.      percussive channel 9 key# 46, Open Hi-Hat, maps to AdLib percussive
  2025.      voice 10, the Hi-Hat). These files are device-dependent and there is one
  2026.      for each RUCKUS-MIDI supported device. Included only in registered versions
  2027.      of the RUCKUS toolkit.
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.                                                                               31
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.      Appendix G. MT-32 MIDI Sound Set.
  2054.  
  2055.  
  2056.      Sound Set Program Number and Name.
  2057.  
  2058.      Prog#  Instrument        Prog#  Instrument       Prog#  Instrument
  2059.      ------------------------------------------------------------------
  2060.        0 AcouPno1              43 EchoPan              86 Bassoon
  2061.        1 AcouPno2              44 DocSolo              87 Harmonca
  2062.        2 AcouPno3              45 SchlDaze             88 Trumpet1
  2063.        3 ElecPno1              46 BellSing             89 Trumpet2
  2064.        4 ElecPno2              47 SqWave               90 Trombon1
  2065.        5 ElecPno3              48 StrSect1             91 Trombon2
  2066.        6 ElecPno4              49 StrSect2             92 FrHorn1
  2067.        7 HonkTonk              50 StrSect3             93 FrHorn2
  2068.        8 ElecOrg1              51 Pizzicto             94 Tuba
  2069.        9 ElecOrg2              52 Violin1              95 BrsSect1
  2070.       10 ElecOrg3              53 Violin2              96 BrsSect2
  2071.       11 ElecOrg4              54 Cello1               97 Vibes1
  2072.       12 PipeOrg1              55 Cello2               98 Vibes2
  2073.       13 PipeOrg2              56 ContraBs             99 SynMallt
  2074.       14 PipeOrg3              57 Harp1               100 WindBell
  2075.       15 Accordn               58 Harp2               101 Glock
  2076.       16 Harpsi1               59 Guitar1             102 TubeBell
  2077.       17 Harpsi2               60 Guitar2             103 XyloPhon
  2078.       18 Harpsi3               61 ElecGtr1            104 Marimba
  2079.       19 Clavi1                62 ElecGtr2            105 Koto
  2080.       20 Clavi2                63 Sitar               106 Sho
  2081.       21 Clavi3                64 AcouBs1             107 Shakuhch
  2082.       22 Celesta1              65 AcouBs2             108 Whistle1
  2083.       23 Celesta2              66 ElecBs1             109 Whistle2
  2084.       24 SynBrss1              67 ElecBs2             110 BottlBlo
  2085.       25 SynBrss2              68 SlapBs1             111 BreathPp
  2086.       26 SynBrss3              69 SlapBs2             112 Timpani
  2087.       27 SynBrss4              70 Fretls1             113 MelodTom
  2088.       28 SynBass1              71 Fretls2             114 DeepSnar
  2089.       29 SynBass2              72 Flute1              115 Oberheim
  2090.       30 SynBass3              73 Flute2              116 Noise
  2091.       31 SynBass4              74 Piccolo1            117 Taiko
  2092.       32 Fantasy               75 Piccolo2            118 TaikoRim
  2093.       33 HarmoPan              76 Recorder            119 RevCymb
  2094.       34 Chorale               77 PanPipes            120 JawHarp
  2095.       35 Glasses               78 Sax1                121 Triangle
  2096.       36 SoundTrk              79 Sax2                122 OrcheHit
  2097.       37 Atmosphr              80 Sax3                123 BassDrm
  2098.       38 WarmBell              81 Sax4                124 BirdTwt
  2099.       39 FunnyVox              82 Clarint1            125 Banjo
  2100.       40 EchoBell              83 Clarint2            126 MoogSyn
  2101.       41 IceRain               84 Oboe                127 JunglTun
  2102.       42 Oboe2001              85 EngHorn
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.                                                                               32
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.      MT-32 Sound Set Groupings by Program Number.
  2121.  
  2122.      Prog#   Instrument Group     Prog#  Ins Grp      Prog#  Ins Grp
  2123.      ----------------------------------------------------------------------
  2124.      Not specified.
  2125.  
  2126.  
  2127.      MT-32 Percussion Map (Channel 9).
  2128.  
  2129.      Key#  Drum Sound       Key#  Drum Sound        Key#  Drum Sound
  2130.      ----------------------------------------------------------------------
  2131.       35 Acoustic Bass       51 Ride Cymbal 1        67 High Agogo
  2132.       36 Acoustic Bass       52*Chinese Cymbal       68 Low Agogo
  2133.       37 Rim Shot            53*Ride Bell            69 Cabasa
  2134.       38 Acoustic Snare      54 Tambourine           70 Maracas
  2135.       39 Hand Clap           55*Splash Cymbal        71 Short Whistle
  2136.       40 Electric Snare      56 Cowbell              72 Long Whistle
  2137.       41 Acoustic Low Tom    57*Crash Cymbal 2       73 Short Guiro
  2138.       42 Closed High Hat     58*Vibraslap            74*Long Guiro
  2139.       43 Acoustic Low Tom    59*Ride Cymbal 2        75 Claves
  2140.       44 Open High Hat 2     60 Hi Bongo             76*Hi Wood Block
  2141.       45 Acoustic Mid Tom    61 Low Bongo            77*Low Wood Block
  2142.       46 Open High Hat 1     62 Mute Hi Conga        78*Mute Cuica
  2143.       47 Acoustic Mid Tom    63 Open Hi Conga        79*Open Cuica
  2144.       48 Acoustic High Tom   64 Low Conga            80*Mute Triangle
  2145.       49 Crash Cymbal        65 High Timbal          81*Open Triangle
  2146.       50 Acoustic High Tom   66 Low Timbal
  2147.  
  2148.  
  2149.      For timbre data used by RUCKUS-MIDI for programs 0-127 see the MTPATCH.*
  2150.      file. Also see that file for percussive voice mappings (for example, how
  2151.      percussive channel 9 key# 46, Open Hi-Hat, maps to AdLib percussive
  2152.      voice 10, the Hi-Hat). These files are device-dependent and there is one
  2153.      for each RUCKUS-MIDI supported device. Included only in registered versions
  2154.      of the RUCKUS toolkit.
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.                                                                               33
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.      Appendix H. RUCKUS-MIDI Patch Map Format.
  2186.  
  2187.  
  2188.      Format of the patch maps used internally by RUCKUS-MIDI for the 2-operator
  2189.      OPL chip is composed of 2 sections. The header and the timbre data. The
  2190.      header is the first 48 bytes of the data.
  2191.  
  2192.      HEADER:
  2193.        Patch name: 20 bytes
  2194.        Patch size: 1 word, set to 48
  2195.          reserved: 14 bytes
  2196.      TIMBRE DATA for each program (0-127):
  2197.        Instrument name: 20 bytes (may be 0- or space-filled)
  2198.        Instrument data: 28 bytes
  2199.  
  2200.        Instrument data format is:
  2201.  
  2202.      Op0:ksl,multi,fb,ar,sl,eg,dr,rr,tl,amvib,vib,ksr,c
  2203.      Op1:ksl,multi,--,ar,sl,eg,dr,rr,tl,amvib,vib,ksr,-
  2204.          mws,cws (modulator wave shape, carrier wave shape)
  2205.  
  2206.      For example:
  2207.  
  2208.      PATCHES_MT  db 'PATCHES_MT32',0,0,0,0
  2209.      dw 48
  2210.      db 14 DUP(0)
  2211.  
  2212.      db 'ACOUPIANO1',0,0,0,0,0,0,0,0,0,0                   ;(0)
  2213.      db 01h,01h,03h,0Fh,05h,00h,01h,00h,0Fh,00h,00h,00h,01h
  2214.      db 00h,00h,01h,00h,0Dh,07h,00h,03h,0Ch,04h,00h,00h,00h
  2215.      db 00h,00h
  2216.      ;the other patches would follow, to the 127th
  2217.      ;total patch size would be 48+(128*48)=6192 bytes
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.                                                                               34
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.      Internally, RUCKUS-MIDI maintains separate locations for the programs and
  2253.      the percussive map. However, for custom patch maps, the following format
  2254.      must be used:
  2255.  
  2256.      Custom Patch Format:
  2257.  
  2258.      First 48-byte section is the percussive map for key numbers 35 to 82. Key
  2259.      number 82 should map to value 255. For example:
  2260.  
  2261.  
  2262.        ;0  1  2  3  4  5  6  7  8  9 (values in decimal, 48 bytes)
  2263.      db                06,06,08,07,08 ;35-39
  2264.      db 07,08,10,08,10,08,10,08,08,09 ;40-49
  2265.      db 08,09,09,09,10,09,09,09,08,09 ;50-59
  2266.      db 08,08,08,08,08,07,07,07,07,08 ;60-69
  2267.      db 10,10,10,10,10,08,08,08,08,08 ;70-79
  2268.      db 10,10,255                     ;80-81
  2269.  
  2270.      ;In the above map, key# 35 maps to OPL-2 voice 6, the bass drum. Key# 79
  2271.      ;maps to voice 8, the tom-tom.
  2272.  
  2273.      ;This is immediately followed by the program patches as above:
  2274.  
  2275.      PATCHES_MT  db 'PATCHES_MT32',0,0,0,0
  2276.      dw 48
  2277.      db 14 DUP(0)
  2278.  
  2279.      db 'ACOUPIANO1',0,0,0,0,0,0,0,0,0,0                   ;(0)
  2280.      db 01h,01h,03h,0Fh,05h,00h,01h,00h,0Fh,00h,00h,00h,01h
  2281.      db 00h,00h,01h,00h,0Dh,07h,00h,03h,0Ch,04h,00h,00h,00h
  2282.      db 00h,00h
  2283.      ;the other patches would follow, to the 127th
  2284.      ;total patch size would be 48+48+(128*48)=6240 bytes
  2285.  
  2286.      To create custom patch maps for the OPL-2 chip, the shareware package
  2287.      SBKTimbre can be used. To convert the output of this program for use with
  2288.      RUCKUS-MIDI, use the supplied IBK2OPL2.EXE program. The 48-byte percussive
  2289.      map must be constructed by hand. 
  2290.  
  2291.      Note that other devices (when supported) will have different formats. 
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.                                                                               35
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.      Appendix Z. Ordering Information, License Agreement and Product Support.
  2318.  
  2319.      To order you must you the order form included with the distribution files.
  2320.      Its filename is !ORDER.FRM. Orders made without this form may be delayed.
  2321.  
  2322.      There are two RUCKUS packages available. The PERSONAL DEVELOPER version is
  2323.      for the hobby-programmer while the PROFESSIONAL version is for the
  2324.      professional programmer.
  2325.  
  2326.      The PERSONAL DEVELOPER version is for persons that are not creating
  2327.      programs for distribution to others. With the PERSONAL DEVELOPER license
  2328.      you may not distribute any programs you create with RUCKUS. In addition, a
  2329.      sign-on banner is issued once, displaying the RUCKUS copyright and license
  2330.      restriction.
  2331.  
  2332.      The PROFESSIONAL version has no distribution restrictions on end-user
  2333.      programs you create with RUCKUS. The PROFESSIONAL license provides you with
  2334.      the right to create all the end-user programs royalty-free. You also have
  2335.      direct access to the latest version of RUCKUS free-of-charge by way of my
  2336.      support BBS and the RUCKUS Developer's Conference there. No sign-on banner
  2337.      is issued.
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.                                                                               36
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.      License Agreement
  2384.  
  2385.      Before using this software you must agree to the following:
  2386.  
  2387.      1. You are not allowed to operate more than one (1) copy of this software
  2388.      package at one time per license. This means that if you have 10 programmers 
  2389.      that COULD possibly use the RUCKUS library at the same time, you must also  
  2390.      have ten (10) RUCKUS licenses. 
  2391.  
  2392.      2. You are not allowed to distribute non-executable code containing RUCKUS 
  2393.      code. This means that you are not allowed to redistribute RUCKUS code as    
  2394.      another .LIB, for example. Also, if RUCKUS code is to be contained in a    
  2395.      Dynamic Link Library (DLL) then it must be part of a stand-alone product. 
  2396.      This means that you cannot provide a .DLL containing RUCKUS code if that    
  2397.      .DLL is to be used as a programming library for other programmers. If you   
  2398.      wish to distribute non-executable code containing RUCKUS code you must    
  2399.      obtain written permission from the author.
  2400.  
  2401.      3. This license grants you the right to use the RUCKUS library code on a   
  2402.      royalty-free basis, except when the license is the PERSONAL DEVELOPER, in
  2403.      which case you may not distribute any program in which RUCKUS has been
  2404.      used.
  2405.  
  2406.      4. RUCKUS is owned by the author, Cornel Huth, and is protected by United  
  2407.      States copyright laws and international treaty provisions. You are not    
  2408.      allowed to make copies of this software except for archival purposes.
  2409.  
  2410.      5. You may not rent or lease RUCKUS. You may not transfer this license
  2411.      without the written permission of the author. If this software is an update
  2412.      or upgrade, you may not sell or give away previous versions.
  2413.  
  2414.      6. You may not reverse engineer, decompile, or disassemble this software.
  2415.  
  2416.      7. There are no expressed or implied warranties with this software.
  2417.  
  2418.      8. All liabilities in the use of this software rest with the user.
  2419.  
  2420.      9. U.S. Government Restricted Rights. This software is provided with    
  2421.      restricted rights. Use, duplication, or disclosure by the Government is    
  2422.      subject to restrictions as set forth in subparagraph (c)(1)(ii) of the    
  2423.      Rights in Technical Data and Computer Software clause at 52.227-7013.    
  2424.      Manufacturer is Cornel Huth/6402 Ingram Rd/San Antonio, TX 78238.
  2425.  
  2426.      This agreement is governed by the laws of the state of Texas.
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.                                                                               37
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.      Product Support
  2450.  
  2451.       BBS support telephone: 1(210)684-8065. V.32bis (1200-14.4k bps)
  2452.       Hours: Monday through Friday, 5pm to 9am next morning
  2453.              Weekend hours are 1pm to 9am next morning.
  2454.              All times USA Central [-0600/-0500]
  2455.  
  2456.      E-mail:
  2457.  
  2458.      Internet: chuth@lonestar.utsa.edu -or-
  2459.                cornel.huth@LChance.sat.tx.us -or-
  2460.                cornel.huth@p8.f800.n387.z1.fidonet.org
  2461.       Fidonet: 1:387/800.8
  2462.  
  2463.      PROFESSIONAL version licensees have _free_ access to all future RUCKUS
  2464.      updates AND upgrades via the RUCKUS Developer's Conference on The Fortieth
  2465.      Floor BBS (1(210)684-8065). PERSONAL DEVELOPER licensees have restricted
  2466.      access to in-version maintenance updates at no charge.
  2467.  
  2468.      End of the RUCKUS-MIDI DOCUMENT. See also the RUCKUS-DAC DOCUMENT.
  2469.